package com.xiaobai.threadPool;

import java.util.concurrent.*;

public class App {
    public static void main(String[] args) {
        final ExecutorService executorService = Executors.newFixedThreadPool(10);

        final Future<?> callable = executorService.submit(() -> {
            System.out.println("aaa");
        });
        while (!callable.isDone()) {
            System.out.println("等待中");
        }

        final ThreadPoolExecutor executor = new ThreadPoolExecutor(2, 10, 3000, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(2), new ThreadFactory() {
            @Override
            public Thread newThread(Runnable r) {
                return new Thread(r, "线程池1111");
            }
        });
        executor.submit(() -> {
            System.out.println("sadsds");
        });
        executor.execute(() -> {
            System.out.println("sadsds");
        });
    }
}
